﻿/**
 *
 * @file UpdateBrowserTable.h
 * @brief 更新表格窗口
 * @author wangning (2185896382@qq.com)
 * @date 2024-01-07
 *
 */
#ifndef _Operators_UpdateBrowserTable_H_
#define _Operators_UpdateBrowserTable_H_

#include "GUIWidget/GraphArea.h"
#include "GUIWidget/BrowserWidget.h"
#include "GUIFrame/MainWindow.h"
#include "GUIFrame/CentralWidget.h"
#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"
#include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h"

namespace ModelOper
{
    /**
     * @brief 更新表格窗口
     * @author wangning (2185896382@qq.com)
     * @date 2024-01-07
     */
    static void updateBrowserTable()
    {
        //获取表格对象
        GUI::MainWindow* mw = FITKAPP->getGlobalData()->getMainWindowT<GUI::MainWindow>();
        if (mw == nullptr) return;
        GUI::CentralWidget* cw = mw->getCentralWidget();
        if (cw == nullptr) return;
        GUI::GraphArea* ga = cw->getGraphArea();
        if (ga == nullptr) return;
        GUI::GraphAbstractSubWin* sw = ga->getFirstWindow(GUI::GraphAbstractSubWin::Browser);
        GUI::BrowserWidget* bw = dynamic_cast<GUI::BrowserWidget*>(sw);
        //更新表格
        if (bw) bw->updateTable();
    };
}

#endif